<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The MongoDB\Driver\WriteConcern class</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="mongodb-driver-bulkwrite.update.html">« MongoDB\Driver\BulkWrite::update</a></li>
      <li style="float: right;"><a href="mongodb-driver-writeconcern.bsonserialize.html">MongoDB\Driver\WriteConcern::bsonSerialize »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="book.mongodb.html">MongoDB\Driver</a></li>
    <li>The MongoDB\Driver\WriteConcern class</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="class.mongodb-driver-writeconcern" class="reference">

 <h1 class="title">The MongoDB\Driver\WriteConcern class</h1>
 

 <div class="partintro"><p class="verinfo">(mongodb &gt;=1.0.0)</p>


  <div class="section" id="mongodb-driver-writeconcern.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    <span class="classname"><strong class="classname">MongoDB\Driver\WriteConcern</strong></span> describes the level of
    acknowledgement requested from MongoDB for write operations to a standalone
    <code class="literal">mongod</code> or to replica sets or to sharded clusters. In
    sharded clusters, <code class="literal">mongos</code> instances will pass the write
    concern on to the shards.
   </p>
  </div>


  <div class="section" id="mongodb-driver-writeconcern.synopsis">
   <h2 class="title">类摘要</h2>


   <div class="classsynopsis">
    <div class="ooclass"></div>


    <div class="classsynopsisinfo">
     <span class="modifier">final</span>
     <span class="ooclass">
      <span class="modifier">class</span> <strong class="classname">MongoDB\Driver\WriteConcern</strong>
     </span>

     <span class="oointerface"><span class="modifier">implements</span> 
       <a href="class.mongodb-bson-serializable.html" class="interfacename">MongoDB\BSON\Serializable</a></span><span class="oointerface">,  <a href="class.serializable.html" class="interfacename">Serializable</a></span> {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Constants */</div>
    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">string</span>
      <var class="fieldsynopsis_varname"><a href="class.mongodb-driver-writeconcern.html#mongodb-driver-writeconcern.constants.majority"><var class="varname">MAJORITY</var></a></var><span class="initializer"> = &quot;majority&quot;</span>;</div>

    
    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="methodname"><a href="mongodb-driver-writeconcern.bsonserialize.html" class="methodname">bsonSerialize</a></span>(): <span class="type">object</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">final</span> <span class="modifier">public</span> <span class="methodname"><a href="mongodb-driver-writeconcern.construct.html" class="methodname">__construct</a></span>(<span class="methodparam"><span class="type"><span class="type">string</span>|<span class="type">int</span></span> <code class="parameter">$w</code></span>, <span class="methodparam"><span class="type">?</span><span class="type"><span class="type">int</span><span class="type"></span></span> <code class="parameter">$wtimeout</code><span class="initializer"> = <strong><code>null</code></strong></span></span>, <span class="methodparam"><span class="type">?</span><span class="type"><span class="type">bool</span><span class="type"></span></span> <code class="parameter">$journal</code><span class="initializer"> = <strong><code>null</code></strong></span></span>)</div>
<div class="methodsynopsis dc-description"><span class="modifier">final</span> <span class="modifier">public</span> <span class="methodname"><a href="mongodb-driver-writeconcern.getjournal.html" class="methodname">getJournal</a></span>(): <span class="type"><span class="type">?</span><span class="type">bool</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">final</span> <span class="modifier">public</span> <span class="methodname"><a href="mongodb-driver-writeconcern.getw.html" class="methodname">getW</a></span>(): <span class="type"><span class="type">string</span>|<span class="type">int</span>|<span class="type">null</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">final</span> <span class="modifier">public</span> <span class="methodname"><a href="mongodb-driver-writeconcern.getwtimeout.html" class="methodname">getWtimeout</a></span>(): <span class="type">int</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">final</span> <span class="modifier">public</span> <span class="methodname"><a href="mongodb-driver-writeconcern.isdefault.html" class="methodname">isDefault</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">final</span> <span class="modifier">public</span> <span class="methodname"><a href="mongodb-driver-writeconcern.serialize.html" class="methodname">serialize</a></span>(): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">final</span> <span class="modifier">public</span> <span class="methodname"><a href="mongodb-driver-writeconcern.unserialize.html" class="methodname">unserialize</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$serialized</code></span>): <span class="type"><span class="type void">void</span></span></div>

   }</div>


  </div>
  

  <div class="section" id="mongodb-driver-writeconcern.constants">
   <h2 class="title">预定义常量</h2>
   <dl>

    
     <dt id="mongodb-driver-writeconcern.constants.majority"><strong><code>MongoDB\Driver\WriteConcern::MAJORITY</code></strong></dt>

     <dd>

      <p class="para">
       Majority of all the members in the set; arbiters, non-voting members,
       passive members, hidden members and delayed members are all included in
       the definition of majority write concern.
      </p>
     </dd>

    

   </dl>

  </div>


  <div class="section">
   <h2 class="title">更新日志</h2>
   <p class="para">
    <table class="doctable informaltable">
     
      <thead>
       <tr>
        <th>版本</th>
        <th>说明</th>
       </tr>

      </thead>

      <tbody class="tbody">
       <tr>
        <td>PECL mongodb 1.7.0</td>
        <td>
         Implements <span class="interfacename"><a href="class.serializable.html" class="interfacename">Serializable</a></span>.
        </td>
       </tr>

       <tr>
        <td>PECL mongodb 1.2.0</td>
        <td>
         Implements <span class="interfacename"><a href="class.mongodb-bson-serializable.html" class="interfacename">MongoDB\BSON\Serializable</a></span>.
        </td>
       </tr>

      </tbody>
     
    </table>

   </p>
  </div>

 </div>

 










































 






 







<h2>目录</h2><ul class="chunklist chunklist_reference"><li><a href="mongodb-driver-writeconcern.bsonserialize.html">MongoDB\Driver\WriteConcern::bsonSerialize</a> — Returns an object for BSON serialization</li><li><a href="mongodb-driver-writeconcern.construct.html">MongoDB\Driver\WriteConcern::__construct</a> — Create a new WriteConcern</li><li><a href="mongodb-driver-writeconcern.getjournal.html">MongoDB\Driver\WriteConcern::getJournal</a> — Returns the WriteConcern's &quot;journal&quot; option</li><li><a href="mongodb-driver-writeconcern.getw.html">MongoDB\Driver\WriteConcern::getW</a> — Returns the WriteConcern's &quot;w&quot; option</li><li><a href="mongodb-driver-writeconcern.getwtimeout.html">MongoDB\Driver\WriteConcern::getWtimeout</a> — Returns the WriteConcern's &quot;wtimeout&quot; option</li><li><a href="mongodb-driver-writeconcern.isdefault.html">MongoDB\Driver\WriteConcern::isDefault</a> — Checks if this is the default write concern</li><li><a href="mongodb-driver-writeconcern.serialize.html">MongoDB\Driver\WriteConcern::serialize</a> — Serialize a WriteConcern</li><li><a href="mongodb-driver-writeconcern.unserialize.html">MongoDB\Driver\WriteConcern::unserialize</a> — Unserialize a WriteConcern</li></ul>
</div>
</div></div></body></html>